package com.zs.interfaces.facade.tuShare;

import com.alibaba.fastjson.JSON;
import com.zs.application.service.tuShare.TuShareStockInfoService;
import com.zs.infrastructure.util.invoker.tushare.request.TuShareStockBasicRequest;
import com.zs.infrastructure.util.invoker.tushare.request.TuShareStockIpoRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author
 * @date 2022/8/25 0025 下午 11:55
 * @desc 证券基础信息控制类-沪深股票
 **/
@Slf4j
@RestController
@RequestMapping("/tuShare/stock")
public class TuShareStockInfoController {

    @Autowired
    private TuShareStockInfoService tuShareStockInfoService;

    /**
     * 证券基础信息抽取
     * @param tuShareStockBasicRequest
     */
    @PostMapping("/extractStockBasic")
    public void extractStockBasic(@RequestBody TuShareStockBasicRequest tuShareStockBasicRequest) {
        log.info("证券基础信息抽取 入参tuShareStockBasicRequest:{}", JSON.toJSONString(tuShareStockBasicRequest));
        tuShareStockInfoService.extractStockBasic(tuShareStockBasicRequest);
        log.info("证券基础信息抽取 出参");
    }

    /**
     * IPO新股数据查询
     * @param tuShareStockIpoRequest
     */
    @PostMapping("/extractNewShare")
    public void extractNewShare(@RequestBody TuShareStockIpoRequest tuShareStockIpoRequest) {
        log.info("IPO新股数据查询 入参tuShareStockIpoRequest:{}", JSON.toJSONString(tuShareStockIpoRequest));
        tuShareStockInfoService.extractNewShare(tuShareStockIpoRequest);
        log.info("IPO新股数据查询 出参");
    }

}
